<?php 

require('inc/db.php');

// 获取文章列表
$sql = "select * from article order by created desc limit 0,3";
$result = mysql_query($sql, $conn);
$news_list = array();
$i = 0;
while( $row = mysql_fetch_assoc( $result ) ) {
	$news_list[$i] = (array)$row;
	$i++;
}

// 获取房源列表
$sql = "select * from house order by created desc limit 0,5";
$result = mysql_query($sql, $conn);
$house_list = array();
$i = 0;
while( $row = mysql_fetch_assoc( $result ) ) {
	$house_list[$i] = (array)$row;
	$i++;
}

// 获取公司简介
$sql = "select * from page where sign='jianjie'";
$result = mysql_query($sql, $conn);
$intro = mysql_fetch_assoc( $result );

// 获取联系方式
$sql = "select * from page where sign='lianxi'";
$result = mysql_query($sql, $conn);
$contact = mysql_fetch_assoc( $result );

?>

<?php include('header.php'); ?>

<div class="wrapper">
	<div class="main">
    	<div class="flash">
        	<img src="images/flash.jpg" />
		</div>
        <div class="khdj">
        	<div class="title">
            	<img src="images/flag_blue.gif" />客户登记
            </div>
            
            <div class="list">
            	<ul>
                	<li><img src="images/tag_orange.gif" /><a href="message.php">我要买房</a></li>
                    <li><img src="images/tag_yellow.gif" /><a href="message.php">我要卖房</a></li>
                  	<li><img src="images/tag_green.gif" /><a href="message.php">我要租房</a></li>
                  	<li><img src="images/tag_pink.gif" /><a href="message.php">我要出租</a></li>
                </ul>
           	</div>
            
            <div class="list1">
            	<img src="images/zxjl.jpg" />
                <ul>
                	<li><img src="images/heart.gif" /><a href="message.php">在线留言</a></li>
                  	<li><img src="images/lightbulb.gif" /><a href="message.php">投诉建议</a></li>
               	</ul>
            </div>
        </div>
        
        <div class="lxfs">
        	<div class="title">联系方式</div>
            <div class="hm">
 				<?php echo $contact['content'] ?>
            </div>
        </div>    
	</div>
        
	<div class="main">
    	<div class="gsjj">
        	<div class="title">
            	<img src="images/readerBlogIndex.gif" /> 公司简介
			</div>
          	<div class="hp">
            	<img src="images/pic.jpg" />
                <?php echo $intro['content'] ?>
            </div>
       	</div>
        
        <div class="tjfy">
        	<div class="title">
            	<img src="images/kylogo.jpg" width="25" height="16" />推荐房源
			</div>
            <div class="fylist">
            	<ul>
            		<?php foreach($house_list as $house) { ?>
                	<li><a href="house.php?id=<?php echo $house['id'] ?>"><?php echo $house['name'] ?></a></li>
                	<?php } ?>
                </ul>
            </div>
        </div>
    </div>
        
    <div class="main">
    	<div class="yypz">
        	<div class="title">
            	<img src="images/bookmark.gif" />业务品种
			</div>
          	<div class="pic">
          		<ul>
          			<li><a href="page.php?sign=maimai">二手房买卖</a></li>
            		<li><a href="page.php?sign=zulin">二手房租赁</a></li>
            		<li><a href="page.php?sign=cehua">销售策划</a></li>
            		<li><a href="page.php?sign=daikuan">按揭贷款</a></li>
            		<li><a href="page.php?sign=gongjijing">公积金贷款</a></li>
            		<li><a href="page.php?sign=zixun">置业咨询</a></li>
            		<li><a href="page.php?sign=quanzheng">代办权证</a></li>
            	</ul>
            </div>
		</div>
        
        <div class="xx">
        	<div class="title">
            	<ul>
              		<li><a href="news_list.php?sort=kaiye">凯业新闻</a></li>  
      			  	<li><a href="news_list.php?sort=fagui">政策法规</a></li>
              	  	<li><a href="news_list.php?sort=hangye">行业新闻</a></li>
              	</ul>
			</div>
            <div class="xxlist">
            	<ul>
            		<?php foreach($news_list as $news) { ?>
                	<li><a href="<?php echo $news['id'] ?>"><?php echo $news['title'] ?></a></li>
                	<?php } ?>
                </ul>
            </div>
          </div>
        </div>
</div>
        
<?php include('footer.php') ?>
